#include <iostream>




class Building2;
class GoodGay1 {
public:
    Building2 *building;

    GoodGay1();

    void visit();

    void visit2();


};
class Building2 {
    // 告诉编译器 GoodCay类下的visit成员函数作为本类的好朋友，可以访问私有成员
    friend void GoodGay1::visit();

public:
    std::string sittingRoom; // 客厅

private:
    std::string bedRoom; // 卧室

public:
    Building2();

};

// 类外写成员函数
Building2::Building2() {
    this->bedRoom = "卧室";
    this->sittingRoom = "客厅";
}
GoodGay1::GoodGay1() {
    building = new Building2();
}

void GoodGay1::visit() {
    std::cout << building->sittingRoom << std::endl;
    std::cout << building->bedRoom << std::endl;
}

void GoodGay1::visit2() {
    std::cout << building->sittingRoom << std::endl;
}


void test01() {
    GoodGay1 goodGay;
    goodGay.visit();
    goodGay.visit2();
}

int main() {
    test01();
    return 0;
}

